import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AuthVO, AuthForm, AuthQuery } from '@/api/authcode/auth/types';

/**
 * 查询设备激活记录列表
 * @param query
 * @returns {*}
 */

export const listAuth = (query?: AuthQuery): AxiosPromise<AuthVO[]> => {
  return request({
    url: '/authcode/auth/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备激活记录详细
 * @param id
 */
export const getAuth = (id: string | number): AxiosPromise<AuthVO> => {
  return request({
    url: '/authcode/auth/' + id,
    method: 'get'
  });
};

/**
 * 新增设备激活记录
 * @param data
 */
export const addAuth = (data: AuthForm) => {
  return request({
    url: '/authcode/auth',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备激活记录
 * @param data
 */
export const updateAuth = (data: AuthForm) => {
  return request({
    url: '/authcode/auth',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备激活记录
 * @param id
 */
export const delAuth = (id: string | number | Array<string | number>) => {
  return request({
    url: '/authcode/auth/' + id,
    method: 'delete'
  });
};
